﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Data.Objects;

namespace Defero.Model
{
    public class EmployeeConfiguration : EntityConfiguration<Employee>
    {
        public EmployeeConfiguration() 
        {
            Property(e => e.Id).IsIdentity();
            Property(e => e.DisplayName).HasDefaultMaxLength();
            Property(e => e.Password).HasDefaultMaxLength();
            
            Relationship(e => e.Person);
            Relationship(e => e.Specialties)
                .FromProperty(e => e.Employee)
                .IsOptional();
            Relationship(e => e.Sales)
                .FromProperty(e => e.Employee)
                .IsOptional();
        }
    }
}
